<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组的find方法</title>
</head>

<body>
  <script>
    // const arr=["one","two","three"]
    // const ret=arr.find(function(item){
    //   return item==="blue"
    // })
    // console.log(ret);
    const arr = [{
      name: '小米',
      price: 1999
    }, {
      name: '华为',
      price: 3999
    }]
   const ret= arr.find(function(item){
      return item.name==="小米"
    })
    console.log(ret);
  </script>
</body>

</html>